package com.jamlu.framework.ui.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ProgressBar;

import com.blankj.utilcode.util.ConvertUtils;
import com.jamlu.framework.R;


public class MyProgressDialog extends Dialog {

    public MyProgressDialog(Context context) {
        super(context, R.style.ProgressDialogStyle);
        ProgressBar progressBar = new ProgressBar(context);
        progressBar.setLayoutParams(new ViewGroup.LayoutParams(ConvertUtils.dp2px(40),ConvertUtils.dp2px(40)));
        setContentView(progressBar);
        if (getWindow() != null) {
            WindowManager.LayoutParams params = getWindow().getAttributes();
            params.gravity = Gravity.CENTER;
            params.width = WindowManager.LayoutParams.WRAP_CONTENT;
            params.height = WindowManager.LayoutParams.WRAP_CONTENT;
            getWindow().setAttributes(params);
        }
        setCancelable(false);
    }

}
